<template>
	<div class="child">
		<ul>
			<li v-for="p in list" :key="p.id" @click="say(p)">
				{{ p.name }} -- {{ p.age }}
			</li>
		</ul>
		<view>{{ slowSpeed }}</view>
	</div>
</template>

<script lang="ts" setup name="Person">
	import { defineEmits } from 'vue';
	interface PersonInter {
		id : string,
		name : string,
		age : number
	}
	type Persons = PersonInter[]
	const propParam = withDefaults(defineProps<{ list ?: Persons; slowSpeed : number; }>(), {
		list: () => [{ id: 'ausydgyu01', name: '康师傅·王麻子·特仑苏', age: 19 }],
		slowSpeed: 100,
	})
	console.log(propParam)
	const emit = defineEmits(["sayHello"]);
	const say = (p : any) => {
		emit('sayHello', p);
	}
	// 第一步：定义子组件的方法
	const hello = (str : string) => {
		console.log('子组件的hello方法执行了--' + str)
	}
	// 第二部：暴露方法
	defineExpose({
		hello
	})
</script>

<style>
</style>